package com.itheima.mRadix.demo;

public class Demo4 {
    /*
        ^ 运算符的特点
                一个数, 被另外一个数, 异或两次, 该数本身不变
     */
    public static void main(String[] args) {

        System.out.println(12 << 1);  // 24
        System.out.println(12 >> 2);  // 3
        System.out.println(10 ^ 5 ^ 10);        //5

        //如何不借助第三个中间变量的情况下实现元素互换
        int a = 6;
        int b = 5;

        a = a ^ b;          // a = 6 ^ 5;
        b = a ^ b;          // b = 6 ^ 5 ^ 5;  --> b = 6;
        a = a ^ b;          // a = 6 ^ 5 ^ 6;  --> a = 5;
        System.out.println("a = " + a);
        System.out.println("b = " + b);


        for(int i = 1,j=5;i<=5;i++){
            System.out.println("helloworld");
        }
    }
}
